
<html>
<head>
    <script language="JavaScript">
        function add(){
            document.getElementById("redirect").value = window.location.href;
            alert(document.getElementById("redirect").value);
        }
    </script>
</head>

<body>
<form action="/cas" onsubmit="add()">
username: <input name="username" /> <br>
password: <input name="password" /> <br>
    <input type="hidden" name="redirect" id="redirect" />
<input type="submit" name="login" />

</form>
</body>
</html>